<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="../common/jstl.jsp" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>角色管理</title>
<%@include file="../common/css-js.jsp" %>
</head>
<body>
	<div class="am-container-fluid">
		<div class="admin-content">
			<!-- iframe start -->
			<div class="admin-content-body">
				 <div class="am-cf am-padding am-padding-bottom-1">
				      <div class="am-fl am-cf">
				        <strong class="am-text-primary am-text-lg">首页</strong> /
				        <small>角色管理</small>
				      </div>
				  </div>
				<div class="am-panel am-panel-default">
				  <div class="am-panel-hd">
				  <form class="am-form" action="${path }/admin/roleinfo/toManagerRole">
				  	<div class="am-g">
						<div class="am-u-md-2 am-text-right">登录账号：</div>
						<div class="am-u-md-2">
							<input type="text" name="loginName" class="am-input-sm">
						</div>
						<div class="am-u-md-1">
						<button class="am-btn am-btn-primary " type="submit">确定</button></div>
						<div class=" am-u-md-7">
					</div>
					</div>
					</form>
				  </div>
				  <div class="am-panel-bd">
				  <c:if test="${manager != null }">
				  <form class="am-form" action="${path }/admin/roleinfo/managerRole">
				  <input type="hidden" name="managerId" value="${manager.managerId }" />
				<table class="am-table am-table-striped am-table-hover table-main">
              <thead>
              <tr>
               <!--  <th class="table-check"><input type="checkbox" /></th><th class="table-id">ID</th> -->
                <th class="table-title">登录账号</th>
                <th class="table-title">角色信息</th>
              </tr>
              </thead>
              <tbody>
              	<tr>
                <td>${manager.loginName }</td>
                <td>
                	<c:forEach items="${roles}" var="role" varStatus="status">
                		<c:choose>
							<c:when test="${not empty hasRoles }"> 
								<c:forEach items="${hasRoles}" var="hasRole">
									<c:choose>
										<c:when test="${role.roleName == hasRole.roleName }">
											<input name="roleIds" value="${role.roleId }" type="checkbox" checked="checked"> ${role.roleName }
										</c:when>
										<c:otherwise>
											<input name="roleIds" value="${role.roleId }" type="checkbox" > ${role.roleName }
										</c:otherwise>
									</c:choose>
								</c:forEach>
							</c:when>
							<c:otherwise>
								<input name="roleIds" value="${role.roleId }" type="checkbox" > ${role.roleName }
							</c:otherwise>
						</c:choose>
						
						
                	</c:forEach>
                </td>
                
              </tr>
              </tbody>
              
            </table>
            <button class="am-btn am-btn-primary " type="submit">确定</button>
              </form>
             </c:if>
				</div>
			</div>
		</div>
	</div>
</body>
</html>